package chapter1.dataabstraction.example;

/**
 * @author quanlinlin on 2018/11/4 16:51.
 * @version 1.0
 */
public class StringTest {

    /**
     * 判断字符串是否为回文
     *
     * @param s
     * @return
     */
    public static boolean isPalindrome(String s) {
        int N = s.length();
        for (int i = 0; i < N / 2; i++) {
            if (s.charAt(i) != s.charAt(N - 1 - i)) {
                return false;
            }
        }
        return true;
    }

    public static void getFileAndExtentionName(String[] args) {
        String s = args[0];
        int dot = s.indexOf(".");
        String base = s.substring(0, dot);
        String extention = s.substring(dot + 1, s.length());
    }


    public static void main(String[] args) {
        getFileAndExtentionName(args);

    }

    public boolean isSorted(String[] a) {
        for (int i = 1; i < a.length; i++) {
            if (a[i - 1].compareTo(a[i]) > 0) {
                return false;
            }
        }
        return true;
    }

}
